package com.jpress.testes;

import java.util.List;

import javax.naming.InitialContext;

import com.jpress.model.Tag;
import com.jpress.remote.DaoJpaBeanRemote;

public class MainTeste {

	public MainTeste() {
		try {
			InitialContext ctx = new InitialContext();
			DaoJpaBeanRemote<Tag> dao = (DaoJpaBeanRemote<Tag>) ctx.lookup("bean/daojpa");
			Tag tag = new Tag();
			tag.setNome("asasdsad");
			dao.persist(tag);
			
			List<Tag> tags = dao.namedQueryResultList("Tag.findAll");
			
			System.out.println("tags:");
			
			for(Tag t: tags) {
				System.out.println(t.getNome());
			}
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}

	public static void main(String[] args) {
		new MainTeste();

	}

}
